<#global maxHeight = 600, maxWidth = 960 >
<style>
    a, a:hover, a:before, a:after {
        text-decoration: none;
        color: black;
    }
    .btn {
        display: inline-block;
        font-weight: 400;
        color: #212529;
        text-align: center;
        vertical-align: middle;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        background-color: transparent;
        border: 0.1rem solid rgb(227, 230, 240);
        padding: 0.75rem 1rem;
        font-size: 1rem;
        line-height: 1.7;
        border-radius: 0.25rem;
        transition: all 0.2s ease-in-out;
    }

    /*小屏幕设备*/
    @media (max-width: 767px) {
        /*------顶部开始------*/
        .header-info {
            padding-bottom: 5px;
        }
        .icon-info {
            display: none;
        }
        .icon-a {
            position: relative;
            top: 50%;
            left: 50%;
            align-items: center;
        }
        .icon-img {
            position: relative;
            top: 10px;
            border-radius: 50%!important;
        }
        .icon-a + .navbar-expand-md {
            padding-left: 0;
        }
        .navbar-expand-md > button {
            margin-left: -15px;
        }
        .u-header--modern .navbar-expand-lg .u-header__hamburger {
            -ms-flex: 0 0 25%;
            flex: 0 0 25%;
            max-width: 25%;
            -ms-flex-order: 1;
            order: 1;
        }
        .d-none {
            display: none !important;
        }
        .u-hamburger__box {
            width: 1.375rem;
            height: 0.7rem;
            display: inline-block;
            position: relative;
        }
        .u-hamburger[aria-expanded="true"] .u-hamburger__inner, .u-hamburger .is-active .u-hamburger__inner {
            -webkit-transform: translate3d(0, 0.275rem, 0) rotate(45deg);
            transform: translate3d(0, 0.275rem, 0) rotate(45deg);
        }
        .u-hamburger:hover .u-hamburger__inner, .u-hamburger:hover .u-hamburger__inner::before, .u-hamburger:hover .u-hamburger__inner::after {
            background-color: #21c87a;
        }
        .u-hamburger__inner, .u-hamburger__inner::before, .u-hamburger__inner::after {
            width: 1.375rem;
            height: 0.15rem;
            background-color: #8c98a4;
            position: absolute;
            transition-property: -webkit-transform;
            transition-property: transform;
            transition-property: transform, -webkit-transform;
            transition-duration: 0.3s;
            transition-timing-function: ease;
        }
        .u-hamburger__inner {
            display: block;
            top: 0.08333rem;
            margin-top: -0.08333rem;
        }
        .u-hamburger__inner::before {
            top: 0.275rem;
            transition-property: opacity, -webkit-transform;
            transition-property: transform, opacity;
            transition-property: transform, opacity, -webkit-transform;
            transition-duration: 0.3s;
            transition-timing-function: ease;
        }
        .u-hamburger[aria-expanded="true"] .u-hamburger__inner::before, .u-hamburger .is-active .u-hamburger__inner::before {
            -webkit-transform: rotate(-45deg) translate3d(-0.19643rem, -0.125rem, 0);
            transform: rotate(-45deg) translate3d(-0.19643rem, -0.125rem, 0);
            opacity: 0;
        }
        .u-hamburger__inner::before, .u-hamburger__inner::after {
            content: "";
            display: block;
        }
        .u-hamburger[aria-expanded="true"] .u-hamburger__inner::after, .u-hamburger .is-active .u-hamburger__inner::after {
            -webkit-transform: translate3d(0, -0.55rem, 0) rotate(-90deg);
            transform: translate3d(0, -0.55rem, 0) rotate(-90deg);
        }
        .u-hamburger__inner::after {
            top: 0.55rem;
        }
        .navbar-light > button {
            border: none;
            outline: none;
        }
        .navbar-light > button:focus {
            outline: 0;
            box-shadow: none;
        }
        #navbarSupportedContent {
            flex-basis: 100%;
            padding: 0.5rem 0 0 0;
        }
        #navbarSupportedContent > ul {
            padding: 0.8rem 0 0 0;
        }
        #navbarSupportedContent > ul > li > a {
            height: 20px;
            line-height: 20px;
            margin: 5% 0;
            display: block;
        }
        /*------顶部结束------*/
    }

    /*中大型屏幕设备*/
    @media (min-width: 768px) {
        ul > li {
            list-style: none;
        }
        /*------顶部开始------*/
        .header-info {
            top: 0;
            bottom: auto;
            border-bottom: 1px solid rgba(255, 255, 255, 0.15);
            z-index: 10;
        }
        .color-black {
            color: black!important;
        }
        .icon-img {
            height: 30px;
            margin-right: 5px;
        }
        .row-border {
            max-width: 960px;
            margin: 0 auto;
            /*#e3e6f0*/
        }
        .icon-a {
            padding: 1rem 1rem .9375rem 1rem;
            border-right: 1px solid rgba(255, 255, 255, 0.15);
            align-items: center;
        }
        .icon-info {
            font-size: 25px;
            line-height: 30px;
            color: white;
            font-weight: 600;
            font-family: 'Kaushan Script', cursive;
        }
        .icon-a + .navbar-expand-md {
            align-items: center;
            padding-top: 0;
            padding-bottom: 0;
            margin-left: auto;
        }
        .nav-li-a {
            padding: 1.375rem 1rem;
            font-size: 16px;
            line-height: 30px;
            color: rgba(255, 255, 255, 0.9);
            font-family: 'Kaushan Script', cursive;
        }
        .u-header__section {
            z-index: 10;
            background-color: #fff;
            transition: background-color 0.3s ease-in-out;
            border-bottom: 1px solid #e3e6f0;
        }
        /*------顶部结束------*/
    }
</style>

<header class="container-fluid header-info u-header__section" id="header_nav">
    <div class="row row-border" style="border-color: #e3e6f0">
        <div class="icon-a" style="border-color: #e3e6f0">
            <a href="/">
                <img src="/images/icon.png" alt="" class="icon-img rounded float-left" height="35">
                <span class="icon-info color-black">cklab</span>
            </a>
        </div>
        <nav class="navbar navbar-expand-md navbar-light">
            <button type="button" class="navbar-toggler btn u-hamburger u-header__hamburger"
                    aria-label="Toggle navigation"
                    aria-expanded="false"
                    aria-controls="navbarSupportedContent"
                    data-toggle="collapse"
                    data-target="#navbarSupportedContent">
                <span class="d-none d-sm-inline-block">Menu</span>
                <span id="hamburgerTrigger" class="u-hamburger__box ml-3">
              <span class="u-hamburger__inner"></span>
            </span>
            </button>
            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav mr-auto">
                    <@security.authorize access="hasAnyRole('ROLE_ADMIN', 'ROLE_SUPER')">
                        <li class="nav-item">
                            <a href="/admin/index" class="nav-li-a color-black">进入后台</a>
                        </li>
                    </@security.authorize>
                    <@security.authorize access="isAuthenticated()">
                    <li class="nav-item">
                        <a href="/showresult" class="nav-li-a color-black">成果展示</a>
                    </li>
                    <li class="nav-item">
                        <a href="/manage" class="nav-li-a color-black">成果管理</a>
                    </li>
                    <li class="nav-item" style="position: relative;">
                        <a class="nav-li-a  color-black dropdown-toggle" href="" id="navbarDropdown" role="button"
                           data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            ${(Session["SPRING_SECURITY_CONTEXT"].authentication.principal.username)!'test'}
                        </a>
                        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                            <a class="dropdown-item" href="/person">个人中心</a>
                            <a class="dropdown-item" href="/myAdd">我的成果</a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" id="logout" href="javascript:;">退出</a>
                        </div>
                    </li>
                    </@security.authorize>
                </ul>
            </div>
        </nav>
    </div>
</header>
<script>
  $(function () {

      $('#logout').click(function () {
          $.post('/logout', function () {
              location.reload()
          })
      })

    function editHeader() {
      let offsetWid = document.documentElement.clientWidth;
      if (/(Android)/i.test(navigator.userAgent)){     // 判断是否为Android手机
        offsetWid = screen.width;
      }else if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)){  // 判断是否为苹果手机
        offsetWid=document.documentElement.clientWidth;
      }
      if (offsetWid > 960) {
        // 监听屏幕滚动,更改页面的基本样式
        $(window).scroll(function(event){
          if ($(window).scrollTop() > 0) {
            $('.header-info').css('position', 'fixed');
          } else {
            $('.header-info').css('position', 'static');
          }
        });
      } else {
        $(window).unbind('scroll');
        $('.header-info').css('position', 'static');
      }
    }
    editHeader();
    $(window).resize(function() {
      editHeader();
    })
  })
</script>